with open('largefile.txt', 'r', encoding='utf-8') as f:
    while True:
        lines = f.readlines(100000)
        if not lines:
            break
        process_lines(lines)  # 假设process_lines是处理每一组lines的函数